const boxEle = document.querySelector('.box')

var throttle = function(func, delay) {
    var prev = Date.now();
    return function() {
        var context = this;   //this指向window
        var args = arguments;
        var now = Date.now();
        3000
        if (now - prev >= delay) {
            func.apply(context, args);
            prev = Date.now();
        }
    }
}
// boxEle.addEventListener('mousemove',throttle(function(e){
//     console.log(e)
// },1000))
function sayHi(){
    console.log('hi')
}

let sayHiThrottle = throttle(sayHi,1000)
boxEle.addEventListener('mousemove',sayHiThrottle)